home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / press.cpp < prev    next >
C/C++ Source or Header  |  1994-10-10  |  1KB  |  58 lines

  1. #include "press.h"
  2. #include <dos.h>
  3.  
  4. void Press::exe(int)
  5.     {
  6.     mouseHideCursor();
  7.     hilite();             // Executed object is always hilited.
  8.     mouseShowCursor();
  9.     while(1)
  10.     {
  11.     mouseShowCursor();
  12.     get_event();       // Defined in ADDEVENT.H, ADDEVENT.CPP
  13.     mouseHideCursor();
  14.     if(e.what == MOUSEEVENT)    // it was mouse
  15.         {
  16.         if(mouse_in(loc(e.where())))     // mouse click on button
  17.         {
  18.         press();
  19.         ::delay(200);
  20.         release();
  21.         global_i[0] = action_type;
  22.                 e.what = KEYEVENT;
  23.         e.key = EVENT_RETURN;
  24.         }
  25.         else                             // outside
  26.         global_i[0] = 0;
  27.         unhilite();
  28.         global_num = 1;
  29.         return;
  30.         }
  31.     else
  32.         {
  33.         switch(e.key)
  34.         {
  35.         case EVENT_F1: return;
  36.         case EVENT_F10:
  37.         case EVENT_ESC:
  38.         case EVENT_TAB:
  39.         case EVENT_F6:
  40.         case EVENT_ALT_F3:
  41.         case EVENT_ALT_F4:
  42.         case EVENT_ALT_TAB:
  43.             unhilite(); mouseShowCursor();
  44.             global_i[0] = 0; global_num = 1;
  45.             return;
  46.         case EVENT_RETURN:
  47.             press(); delay(200); release();
  48.             mouseShowCursor();
  49.             global_i[0] = action_type;
  50.             global_num = 1;
  51.                     return;
  52.         case EVENT_F2:
  53.         default:
  54.             break;                   // return;
  55.         }
  56.         }
  57.      }
  58.     }